/**
 * 
 */
package pl.edu.agh.to;

import java.util.ArrayList;
import java.util.List;

import android.app.Dialog;

/**
 * @author karulis
 * 
 */
public class DialogsHandler {
	private final List<Integer> dialogs = new ArrayList<Integer>();

	boolean prepareDialog(Integer dialogId, Dialog dialog) {
		if (dialogs.contains(dialogId)) {
			((OrganizerDialog) dialog).prepare();
			return true;
		} else {
			return false;
		}
	}

	Dialog dialog(Integer id, TemplateActivity templateActivity) {
		dialogs.add(id);
		switch (id) {

		case R.id.add_course:
			return new CourseAddDialog(templateActivity);
		case R.id.remove_course:
			return new CourseRemoveDialog(templateActivity);
		case R.id.edit_course:
			return new CourseEditDialog(templateActivity);
		case R.id.add_to_course:
			return new AddToCourseDialog(templateActivity);
		case R.id.remove_from_course:
			return new RemoveFromCourseDialog(templateActivity);

		case R.id.add_participant:
			return new ParticipantAddDialog(templateActivity);
		case R.id.remove_participant:
			return new ParticipantRemoveDialog(templateActivity);
		case R.id.edit_participant:
			return new ParticipantEditDialog(templateActivity);
		case R.id.add_participant_to_course:
			return new AddParticipantToDialog(templateActivity);
		case R.id.remove_participant_from_course:
			return new RemoveParticipantFromDialog(templateActivity);

		case R.id.add_rate:
			return new RateAddDialog(templateActivity);
		case R.id.remove_rate:
			return new RateRemoveDialog(templateActivity);

		case R.id.schedule_add:
			return new ScheduleAddDialog(templateActivity);
		case R.id.schedule_remove:
			return new RemoveSchedule(templateActivity);

		default:
			dialogs.remove(id);
			return null;
		}
	}
}
